package com.work.order.restTemplate;

import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

//@Configuration
public class RestTemplateConfig {
    /**
     * sentinel对restTemplate支持
     * 不是全局Feign调用的处理
     * 仅对当前restTemplate有效
     * @return
     */
    @Bean
    @SentinelRestTemplate(blockHandler = "handleException", fallback = "fallback", fallbackClass = ExceptionUtil.class, blockHandlerClass = ExceptionUtil.class)
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
